unit uRace2.local;

interface

type
  TRace = class( TObject )
  public
    Grid : array of integer; // array holding driver ID for positions.

    Lap       : integer;
    TotalLaps : integer;

//functions
    constructor Create();
    destructor Destroy; override;
    procedure Reset();

    procedure SelectDriver();
  end;

implementation

uses uDebug.common;

constructor TRace.Create();
begin
  inherited Create;

  DevConsole.Msg(ES_DEBUG, '[TRace.Create]');

  SetLength( Grid, Game.WorldBase.DriverList.Count );

  FastestDriver := TFastestLap.Create();
end;
destructor TRace.Destroy;
begin
  SetLength( Grid, 0 );

  inherited Destroy;
end;
procedure TRace.Reset();
var G : integer;
begin
  for G := 0 to High( Grid ) do
    Game.Driver( G ).SetSession();

  with Game.Track(TrackInfo) do
    Grip := Grip - 50; //Reduces grip from each session

  Lap       := 0;
  TotalLaps := 0;
  Weather   := 0;
end;

end.
